package com.yulongtian.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yulongtian.domain.User;
import com.yulongtian.service.LoginService;
import com.yulongtian.utils.R;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author yulongTian
 * @create 2022-10-30 10:10
 */
@RestController
@RequestMapping("/sys_user")
@Api(tags = "登录接口")
public class LoginController {

    @Autowired
    private LoginService loginService;

    @PostMapping("/login")
    @ApiOperationSupport(order = 1)
    public R login(@RequestBody User user) {
        //登录
        return loginService.login(user);
    }

    @GetMapping("/logout")
    @ApiOperationSupport(order = 2)
    public R logout() {
        return loginService.logout();
    }

}
